package com.ys.service.sys;

import java.util.List;

import org.springframework.ui.Model;

import com.bo.dto.NameValueSelectDto;
import com.ys.dto.DtreeSqlDto;
import com.ys.vo.R;

import lombok.AllArgsConstructor;
import lombok.Data;

public interface YsColService {

	DtreeSqlDto dtree();
	
	R add(Long menuId, String code, String name, Integer authType, Integer frontFixed, Integer frontWidth,
			Integer sortNo, String frontType, Integer frontShow, Integer frontEdit, Integer frontConditionState,
			String frontConditionType, String frontConditionRangeType, String frontConditionCode, String frontConditionDefault,Integer frontExport);
	
	R deleteTrue(Long id);
	
	@Data
	@AllArgsConstructor
	public class ToResortDto{
		private List<RowDto> rows; // 数据行
		
		@Data
		@AllArgsConstructor
		public static class RowDto {
			private Long id; // 字段ID
			private String name; // 字段名称
		}
	}
	
	String toSettingOption(Model model, Long colId);
	@Data
	@AllArgsConstructor
	public static class ToSettingOptionDto{
		private Long colId; // ID
		private String name; // 字段名
		private String code; // 字段编码
		private String dictKeyBase; // 字典KEY
		private List<RowDto> rows;
		
		@Data
		@AllArgsConstructor
		public static class RowDto {
			private Long id; // 字典ID
			private String dictName; // 字典名
			private String dictValue; // 字典值
		}
	}
	
	String toSettingDropdownMulty(Model model, Long colId);
	@Data
	@AllArgsConstructor
	public static class ToSettingDropdownMultyDto{
		private Long colId; // ID
		private String name; // 字段名
		private String code; // 字段编码
		private String dropdownRequestPath; // 数据请求路径
	}
	
	String toSettingForm(Model model, Long menuId);
	@Data
	@AllArgsConstructor
	public static class ToSettingFormDto{
		private Long menuId; // 
		private List<RowDto> rowsAdd;
		private List<RowDto> rowsEdit;
		
		@Data
		@AllArgsConstructor
		public static class RowDto {
			private Long id; // 字段ID
			private String code; // 字段编码
			private String name; // 字段名称
			private List<NameValueSelectDto> typeArr; // 字段类型
			private List<NameValueSelectDto> stateArr; // 是否开启
			private List<NameValueSelectDto> requiredArr; // 是否开启
		}
	}

	R settingOption(Long colId, String dictKeyBase);

	R settingDropdownMulty(Long colId, String dropdownRequestPath);
	
	String toSettingSelectorModal(Model model, Long id);
	@Data
	@AllArgsConstructor
	public static class ToSettingSelectorModalDto{
		private Long id; // ID
		private String name; // 字段名
		private String code; // 字段编码
		private SelectorModalInfoDto selectorModalInfo; // 弹出框配置信息

		@Data
		@AllArgsConstructor
		public static class SelectorModalInfoDto {
			private List<NameValueSelectDto> modalArr; // 弹出框数组
		}
	}

	R settingSelectorModal(Long id, Long idYsModalSelector);

	R settingMultyFileSourceType(Long id, Integer multyFileSourceType);
	
	String toSettingMultyFileSourceType(Model model, Long colId);
	@Data
	@AllArgsConstructor
	public static class ToSettingMultyFileSourceTypeDto{
		private Long id; // ID
		private String name; // 字段名
		private String code; // 字段编码
		private List<NameValueSelectDto> rows;
	}

	R settingImport(Long id, Integer importState);
}
